# -*- coding: utf-8 -*-
"""
-------------------------------------------------
# @Project  :pythonProject
# @File     :wareHouse
# @Date     :2021/8/27 9:59
# @Author   :zhumenglong
# @Software :PyCharm
-------------------------------------------------
"""

import json
import os
import sys
import numpy as np
import shutil
import cv2
import random
import demjson
import math
import urllib
main_joint_pairs = [[0, 1], [1, 3], [0, 2], [2, 4],
                    [5, 6], [5, 7], [7, 9], [6, 8], [8, 10],
                    [5, 11], [6, 12], [11, 12],
                    [11, 13], [12, 14], [13, 15], [14, 16],
                    [17, 15], [19, 15], [18, 16], [20, 16], [22, 9], [23, 10],
                    [21, 0]]

colors = [[255, 0, 0], [255, 85, 0], [255, 170, 0], [255, 255, 0],
          [170, 255, 0], [85, 255, 0], [0, 255, 0], \
          [0, 255, 85], [0, 255, 170], [0, 255, 255], [0, 170, 255],
          [0, 85, 255], [0, 0, 255], [85, 0, 255], \
          [170, 0, 255], [255, 0, 255], [255, 0, 0], [255, 85, 0],
          [255, 170, 0], [255, 255, 0], [170, 255, 0], [85, 255, 0],
          [0, 0, 255]]

class method:
    def cv2_imread(path,flag):
        img = cv2.imdecode(np.fromfile(path,dtype=np.uint8),flag)
        return img

    def cv2_imwrite_jpg(path,img):
        cv2.imencode(".jpg",img)[1].tofile(path)

    def cv2_imwrite_jpeg(path,img):
        cv2.imencode(".jpeg",img)[1].tofile(path)

    def cv2_imwrite_png(path,img):
        cv2.imencode(".png",img)[1].tofile(path)

    def create_path(goal_path):
        if not os.path.exists('./'+goal_path+'/'):
            os.makedirs('./'+goal_path+'/')